#!/bin/bash
mysqladmin -u root -P13306 password 'raisecom@123' 2>/dev/null && {
mysql -uroot -praisecom@123 -P13306 -e "grant all privileges on hss.* to hss@localhost identified by 'raisecom@123';flush privileges;"
}
MYSQL_CMD="mysql -uroot -praisecom@123 -P13306"
drop_db_sql="drop database if exists rtms"
create_db_sql="create database rtms CHARACTER SET utf8"
echo ${drop_db_sql} | ${MYSQL_CMD}
echo ${create_db_sql} | ${MYSQL_CMD}

sqlfile=`find ./*/dbscript/ -name *.sql`
echo ${sql}
fstr=`echo $sqlfile | cut -d \  -f 1`
i=1
while [[ $fstr != "" ]]
do
mysql -uroot -praisecom@123 -P13306 rtms -e "source $fstr"
let "i++"
echo "--------------------"
fstr=`echo $sqlfile | cut -d \  -f $i`
done


